#include<iostream>
#include<unistd.h>
#include<signal.h>
#include<sys/wait.h>
#include<sys/types.h>

void notice(int signo)
{
    std::cout<<"I am father prcess, get a "<<signo<< " signo, pid: "<<getpid()<<std::endl;

}

int main()
{
    signal(SIGCHLD,notice);
    pid_t id = fork();               //创建子进程
    if(id==0)
    {
        std::cout<<"I am child process, pid: "<<getpid()<<std::endl;
        sleep(1);
        exit(1);
    }

    //父进程
    sleep(10);            //子进程推出后，到父进程，直接等待10s
}